import { IPSDECMGroupItem } from './ipsdecmgroup-item';
import { IPSDEContextMenuItem } from './ipsdecontext-menu-item';
import { IPSDETBGroupItem } from './ipsdetbgroup-item';
import { IPSDEToolbarItem } from './ipsdetoolbar-item';
import { PSDEToolbarItemImpl } from './psdetoolbar-item-impl';

export class PSDETBGroupItemImpl extends PSDEToolbarItemImpl implements IPSDETBGroupItem, IPSDECMGroupItem {
  protected psdecontextmenuitems: IPSDEContextMenuItem[] | null = null;

  getPSDEContextMenuItems(): IPSDEContextMenuItem[] | null {
    if (this.psdecontextmenuitems == null) {
      this.psdecontextmenuitems = this.fillChildListModel(this.M.getPSDEContextMenuItems, 'control.toolbar.IPSDEContextMenuItem') as IPSDEContextMenuItem[];
    }
    return this.psdecontextmenuitems;
  }

  get psDEContextMenuItems(): IPSDEContextMenuItem[] | null {
    return this.getPSDEContextMenuItems();
  }

  findPSDEContextMenuItem(objKey: any): IPSDEContextMenuItem | null {
    return this.getPSModel5('control.toolbar.IPSDEContextMenuItem', this.getPSDEContextMenuItems(), objKey) as IPSDEContextMenuItem;
  }

  protected psdetoolbaritems: IPSDEToolbarItem[] | null = null;

  getPSDEToolbarItems(): IPSDEToolbarItem[] | null {
    if (this.psdetoolbaritems == null) {
      this.psdetoolbaritems = this.fillChildListModel(this.M.getPSDEToolbarItems, 'control.toolbar.IPSDEToolbarItem') as IPSDEToolbarItem[];
    }
    return this.psdetoolbaritems;
  }

  get psDEToolbarItems(): IPSDEToolbarItem[] | null {
    return this.getPSDEToolbarItems();
  }

  findPSDEToolbarItem(objKey: any): IPSDEToolbarItem | null {
    return this.getPSModel5('control.toolbar.IPSDEToolbarItem', this.getPSDEToolbarItems(), objKey) as IPSDEToolbarItem;
  }

  get valid(): boolean {
    return this.M.valid != null ? this.M.valid : true;
  }

  get cls(): string {
    return 'PSDETBGroupItemImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.toolbar.IPSDECMGroupItem' || cls == 'control.toolbar.IPSDETBGroupItem') return true;
    return super.instanceof(cls);
  }
}
